package com.mqtt.demo.init;

import com.mqtt.demo.mqtt.MyMqttClient;
import jakarta.annotation.Resource;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @ClassName MqttMonitor
 * @Description mqtt监听
 * @Author zhengmw
 * @Data 2024/7/25 19:29
 */
@Component
public class MqttMonitor implements ApplicationRunner {
    @Resource
    private MyMqttClient mqttClient;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        mqttClient.connectAndSubscribe();
    }
}
